package com.fiblue.soexcel.utils;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.fastjson2.JSON;
import com.fiblue.soexcel.listener.PeopleListener;
import com.fiblue.soexcel.pojo.PeopleData;
import org.springframework.stereotype.Component;

import java.io.File;
@Component
public class ReadExcle {
    final static String path="D:\\hacker\\code\\soexcel\\temp\\六寨镇现享受城乡低保成员信息.xlsx";
    public void getData(){
        String fileName = path;
        // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
        // 具体需要返回多少行可以在`PageReadListener`的构造函数设置
        EasyExcel.read(fileName, PeopleData.class, new PeopleListener()).sheet().doRead();
        //ReadSheet readSheet = EasyExcel.readSheet(0).build();
        // 读取一个sheet
    }
}
